﻿@{
    ViewBag.Title = "登录";
    Layout = "~/Views/Shared/_LayoutLogOn.cshtml";
}
@section head{
    <script type="text/javascript">
    </script>
}
<div class="main-content">
    <div class="row">
        <div class="col-sm-10 col-sm-offset-1">
            <div class="login-container">
                <div class="position-relative" style="padding-top: 30%;">
                    <div id="login-box" class="login-box visible widget-box no-border">
                        <div class="widget-body">
                            <div class="widget-main">
                                <h4 class="header blue lighter bigger">
                                    请输入你的登录信息
                                </h4>
                                <form class="form-horizontal" method="post">
                                    <label class="block clearfix">
                                        用户名
                                        <span class="block input-icon input-icon-right">
                                            @if(ViewBag.HasUserName)
                                            {
                                                <input id="editAccount" name="UserName" type="text" class="form-control" placeholder="Username" value="@ViewBag.UserName" readonly="readonly" />
                                                <i class="icon-user"></i>
                                            }
                                            else
                                            {
                                                <input id="editAccount" name="UserName" type="text" class="form-control" placeholder="Username" />
                                                <i class="icon-user"></i>
                                            }
                                        </span>
                                    </label>
                                    <label class="block clearfix">
                                        密&nbsp;码
                                        <span class="block input-icon input-icon-right">
                                            <input id="editPassword" type="password" name="Password" class="form-control" placeholder="Password" />
                                            <i class="icon-lock"></i>
                                        </span>
                                    </label>
                                    <label class="block clearfix">
                                        验证码
                                        <span class="block input-icon input-icon-right">
                                            <input class="form-control left" style="display:inline; width:70%" placeholder="验证码"  name="verifyCode" type="text"/>
                                            <img style="height:32px;" class="right" id="imgVerifycode"/>
                                        </span>
                                    </label>

                                    <div class="space"></div>

                                    <div class="clearfix">
                                        <input name="rememberMe" type="checkbox"/><label class="inline" for="rememberMe">Remember me?</label>
                                        <button class="pull-right btn btn-primary" id="btnLogin" type="submit">
                                            <i class="icon-key"></i>
                                            登录
                                        </button>
                                    </div>
                                    <div class="space-4"></div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section script{
    <script type="text/javascript">
        document.onkeydown = function (e) {
            var theEvent = window.event || e;
            var code = theEvent.keyCode || theEvent.which;
            if (code == 13) {
                $('#btnLogin').click();
            }
        }

        $(document).ready(function () {
            $('#imgVerifycode').on('click', function () {
                $(this).attr("src", "../Verifycode/LogOn?t=" + Date().toString());
            });
            $('#imgVerifycode').attr("src", "../Verifycode/LogOn?t=" + Date().toString());
     
            @*$('#btnLogin').on('click', function () {
                cppei.busy(true)
                //登录
                $.ajax({
                    method: 'post',
                    url: jframe.getUrl('account/login'),
                    contentType: "application/json; charset=utf-8",
                    dataType: 'json',
                    data: JSON.stringify({ account: '@ViewBag.Account', password: $('#editPassword').val() }),
                    success: function (data, status) {
                        if (data.isSuccess) {
                            window.location.href = 'http://localhost:3636/openid/authorize';
                        }
                        else {
                            cppei.growlError(data.message);
                            cppei.busy(false);
                        }
                    },
                    error: function (data, status) {
                        cppei.growl(data.message);
                        cppei.busy(false);
                    }
                });
            });*@
        });
    </script>
}